import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: yang
 * Date: 2022-04-24
 * Time: 19:33
 */
public class Main {
    public static boolean judge(int year){
        if((year%4 == 0 && year%100 !=0 )|| year%400 == 0)
            return true;
        else return false;
    }
    public static void main(String[] args) {
        for (int i = 1000; i <= 2000; i++) {
            if(judge(i)){
                System.out.println(i);
            }
        }
    }
}
